
/**
 * created on 2012-03-21
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-03-21         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.founder.bm.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.founder.bm.dao.ILoginUserDao;
import com.founder.bm.entity.LoginUserTo;	

public class LoginUserDaoImpl extends BaseDaoImpl implements ILoginUserDao {
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #searchLoginUserList(java.util.Map)
	 */
	public List<LoginUserTo> searchLoginUserList(
			Map<String, Object> paramMap) {
		return this.queryForList("loginUser.searchLoginUser", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #searchLoginUserPagination(java.util.Map, int, int)
	 */
	public List<LoginUserTo> searchLoginUserPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("loginUser.searchLoginUser",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #getLoginUserCount(java.util.Map)
	 */
	public Integer getLoginUserCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("loginUser.getLoginUserCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #getLoginUserByPrimaryKey(String)
	 */
	public LoginUserTo getLoginUserByPrimaryKey(String userId) {
		return (LoginUserTo) queryForObject("loginUser.getLoginUserByPrimaryKey", userId);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #insertLoginUser(com.founder.bm.entity.LoginUserTo)
	 */
	public Object insertLoginUser(LoginUserTo loginUser) {
		return this.create("loginUser.insertLoginUser", loginUser);		
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #updateLoginUserByBean(com.founder.bm.entity.LoginUserTo)
	 */
	public int updateLoginUserByBean(LoginUserTo loginUser) {
		return this.update("loginUser.updateLoginUser.byBean", loginUser);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #updateLoginUserByProperty(java.util.Map)
	 */
	public int updateLoginUserByProperty(Map<String, Object> paramMap) {
		return this.update("loginUser.updateLoginUser.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #deleteLoginUserByPrimaryKey(String)
	 */
	public int deleteLoginUserByPrimaryKey(String userId) {
		return this.delete("loginUser.deleteLoginUserByPrimaryKey", userId);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.ILoginUserDao
	 *      #deleteLoginUserBatch(String[])
	 */
	public void deleteLoginUserBatch(String[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (String key : keyArray) {
				sqlMap.delete("loginUser.deleteLoginUserByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
		
}	
	
